CSARCH2 Comprehensive Reviewer and Practice Exam
Tags: #◇Computer Science #◇CSARCH2 #◇Computer Architecture #◇Hardware Modeling #◇[REV] CSARCH2 Comprehensive Reviewer and Practice Exam
◇Overview
This comprehensive examination reviewer consolidates the complete theoretical, mathematical, and microarchitectural curriculum of Computer Systems Architecture 2 (CSARCH2). It covers all 17 course modules, spanning positional base conversions, 2's complement arithmetic and overflow detection, Carry Lookahead Adders, sequential and array multipliers, Booth's and Extended Booth's signed multiplication, restoring and non-restoring binary division, IEEE 754 binary and decimal floating-point representations, Unicode UTF encoding, single-bus CPU datapath organization, microprogramming control sequences, cache mapping architectures, cache replacement policies, virtual memory paging/TLB translation, and instruction pipelining hazards.
◇Key Definitions
- Arithmetic Logic Unit (ALU): The core digital combinational and sequential execution engine that performs arithmetic operations and bitwise boolean evaluations.
- Carry Lookahead Adder (CLA): An optimized adder computing carries in parallel via Generate () and Propagate () functions with logarithmic delay .
- Booth's Algorithm (Radix-2): A signed multiplication algorithm that inspects adjacent bit pairs to replace contiguous strings of 1s with single add/subtract operations.
- Extended Booth's Algorithm (Radix-4): A bit-pair recoding technique evaluating 3-bit overlapping windows to halve the number of multiplication cycles to .
- Non-Restoring Division: A binary division algorithm that eliminates intermediate restoring additions by deferring corrections to subsequent cycles ().
- IEEE 754 Binary Floating-Point: A standardized binary real number format consisting of a Sign bit, a Biased Exponent (), and a Fraction (), incorporating Denormals for gradual underflow.
- Control Store: An internal high-speed on-chip ROM/SRAM containing the microinstructions that generate control signals for instruction execution.
- -Way Set-Associative Cache: A cache mapping scheme dividing storage into sets of lines, balancing the hardware simplicity of direct mapping with the conflict resilience of associativity.
- Average Memory Access Time (AMAT): .
- Translation Lookaside Buffer (TLB): An on-chip associative cache inside the MMU holding recently translated Page Table Entries to accelerate virtual memory address resolution.
- Pipeline Hazard: A condition (Structural, Data, or Control) that prevents the next instruction in the instruction stream from executing in its designated clock cycle.
◇Theoretical Framework / Core Concepts
1. Curriculum Architectural Map & Formula Matrix
+-------------------------------------------------------------------------------+
| CSARCH2 COMPLETE FORMULA MATRIX |
| |
| 1. CPU Execution Time: |
| CPU Time = (Instruction Count * CPI) / Clock Frequency |
| |
| 2. Amdahl's Law Speedup: |
| S_overall = 1 / ((1 - F) + (F / k)) |
| |
| 3. Signed 2's Complement Overflow: |
| V = C_n ^ C_{n-1} (Overflow if carry into MSB != carry out of MSB) |
| |
| 4. Carry Lookahead Recurrences: |
| G_i = A_i * B_i, P_i = A_i ^ B_i, C_{i+1} = G_i + P_i * C_i |
| |
| 5. Radix-4 Booth's Multiplier Factor: |
| X_i = -2 * Q_{2i+1} + Q_{2i} + Q_{2i-1} |
| |
| 6. IEEE 754 Normalized Real Value: |
| Value = (-1)^S * (1.f)_2 * 2^(E' - Bias) |
| Single Prec: Bias = 127; Double Prec: Bias = 1023 |
| Denormalized: Value = (-1)^S * (0.f)_2 * 2^(1 - Bias) |
| |
| 7. Cache Address Field Bit Splitting: |
| Offset bits: w = log2(Bytes per block) |
| Direct Map: Line bits k = log2(Lines), Tag bits t = n - k - w |
| k-Way Set: Set bits s = log2(Sets = Lines/k), Tag bits t = n - s - w |
| |
| 8. Multi-Level AMAT: |
| AMAT = t_h1 + m1 * (t_h2 + m2 * (t_h3 + m3 * t_DRAM)) |
| |
| 9. Ideal Pipeline Speedup: |
| S_k = (n * k) / (k + n - 1) ---> k (as n -> infinity) |
+-------------------------------------------------------------------------------+
◇Worked Examples / Calculations / Hardware Traces
Problem 1: Mixed-Base Number Conversion with Fractions
Question: Convert to Binary, Octal, and Hexadecimal.
Solution:
- Integer part via successive division:
Read upward: .
- Fractional part via successive multiplication:
Read downward: .
- Binary: .
- Octal (Group 3 bits): .
- Hexadecimal (Group 4 bits): .
Problem 2: 2's Complement Signed Addition and Overflow Trace
Question: Perform 5-bit signed addition: and . Determine sum, carries , unsigned overflow, and signed overflow ().
Solution:
Carry: 1 0 1 0 0 0 (C5 = 1, C4 = 0)
A: 1 0 1 1 0 (-10)
B: 1 0 1 0 1 (-11)
-------------------
Sum: 0 1 0 1 1 (+11 in 5-bit 2's comp!)
- , .
- Unsigned Overflow .
- Signed Overflow .
- Conclusion: Signed overflow occurred because adding two negative numbers produced a positive result ( instead of true sum , which is outside 5-bit range ).
Problem 3: Radix-2 Booth's Multiplication Trace ()
Question: Multiply 4-bit signed numbers and using Booth's algorithm. Expected: .
Setup:
- , .
- Initial state: .
| Cycle | Operation | Count | ||||
|---|---|---|---|---|---|---|
| 0 | — | Init | 0000 | 1100 | 0 | 4 |
| 1 | 00 | ASR | 0000 | 0110 | 0 | 3 |
| 2 | 00 | ASR | 0000 | 0011 | 0 | 2 |
| 3 | 10 | (0000 + 0101 = 0101) | 0101 | 0011 | 0 | 2 |
| ASR | 0010 | 1001 | 1 | 1 | ||
| 4 | 11 | ASR | 0001 | 0100 | 1 | 0 |
- Result:
Problem 4: Non-Restoring Division Trace ()
Question: Divide () by (5-bit) using Non-Restoring Division. Expected: , .
| Cycle | Prev Sign | Operation | Count | ||
|---|---|---|---|---|---|
| 0 | — | Init | 00000 | 1110 | 4 |
| 1 | 00001 | 110_ | 4 | ||
11101 | 1100 | 3 () | |||
| 2 | 11011 | 100_ | 3 | ||
11111 | 1000 | 2 () | |||
| 3 | 11111 | 000_ | 2 | ||
00011 | 0001 | 1 () | |||
| 4 | 00110 | 001_ | 1 | ||
00010 | 0011 | 0 () |
- Result: ,
Problem 5: Single-Bus CPU Microprogram for MOV [EDI + EDX*4 + 0x30], EAX
Question: Write the microinstruction control sequence for storing register EAX into memory with Scaled Index Base Displacement addressing.
Solution:
1. PC_out, MAR_in, Read, Select4, ADD, Z_in ; Universal Fetch 1
2. Z_out, PC_in, WMFC ; Universal Fetch 2
3. MDR_out, IR_in ; Universal Fetch 3 (Decode)
-------------------------------------------------------------------------
4. EDX_out, Select4, MUL, Z_in ; Z = EDX * 4
5. Z_out, Y_in ; Y = EDX * 4
6. EDI_out, SelectY, ADD, Z_in ; Z = EDI + (EDX * 4)
7. Z_out, Y_in ; Y = EDI + (EDX * 4)
8. IRAF_out, SelectY, ADD, Z_in ; Z = 0x30 + EDI + (EDX * 4) [EA]
9. Z_out, MAR_in ; MAR = EA
10. EAX_out, MDR_in, Write ; Load EAX into MDR; issue Write
11. WMFC, END ; Wait for Write Complete
Problem 6: 4-Way Set-Associative Cache Sizing & AMAT
Question: A 32-bit byte-addressable system has a 4-way set-associative cache with 64-byte blocks. L1 Hit Time , L1 Miss Rate , Main DRAM Penalty .
- Find address bits for TAG, SET, WORD.
- Find total hardware bits required (including Tag, Valid, Dirty bits).
- Compute Average Memory Access Time (AMAT).
Solution:
- Address Fields:
- Offset: .
- Total lines: .
- Sets: .
- Tag: .
- Format: .
- Total Hardware Bits:
- AMAT:
◇Complexity Analysis / Common Pitfalls
- Confusing Radix-2 vs. Radix-4 Booth's Multipliers: In Radix-2, we inspect pairs and shift by 1 bit (). In Radix-4, we inspect triplets and shift by 2 bits.
- Forgetting the Biased Exponent Offset in Float Multiplication: When multiplying floats, adding two biased exponents yields . Hardware must subtract one to restore the proper encoding.
- Single-Bus Multiple Output Bus Contention: In microprogramming questions, never assert two
_outsignals on the same step (e.g.,PC_outandEBX_outsimultaneously).
◇References & Navigation
- Related Notes: ◇Computer Architecture 2